package com.maizhi.controller;

import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.maizhi.httpmodel.*;
import com.alibaba.fastjson.JSON;
import com.maizhi.model.*;
import com.maizhi.service.BaseServiceI;
import com.maizhi.service.UserServiceI;
import com.maizhi.util.*;
import com.sun.org.apache.commons.beanutils.BeanUtils;


@Controller
@RequestMapping("/xtglController")
public class xtglController extends BaseController {

	private Logger log = Logger.getLogger(xtglController.class);
	
	//BaseServiceI<User> userService;
	BaseServiceI<MenuModel> menuService;
	UserServiceI    userService;

	public UserServiceI getUserService() {
		return userService;
	}

	@Autowired
	public void setUserService(UserServiceI userService) {
		this.userService = userService;
	}

	public BaseServiceI<MenuModel> getMenuService() {
		return menuService;
	}

	@Autowired
	public void setMenuService(BaseServiceI baseService) {
		this.menuService = baseService;
	}
 
	//登录用户
	public UserI getLoginUser(HttpSession session){
		SessionInfo sessionInfo;
		try{
			sessionInfo = (SessionInfo)session.getAttribute(ResourceUtil.getSessionInfoName());
			if(sessionInfo==null){
				return null;
			}
		}catch(Exception e){
			return null;
		}
		return sessionInfo.getUser();
	}
	
}
